<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="/res/third/bootstrap3/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="/res/common/js/jquery.1.9.1.min.js" type="text/javascript"></script>
<script src="/res/third/artDialog/jquery.artDialog.js" type="text/javascript"></script>
<script src="/res/third/validate/jquery.validate.js" type="text/javascript"></script>
<script type="text/javascript">
	function sosuo() {
		var lpath = location.pathname;
		$("#soform").attr("action", lpath + "?pageNo=" + 1);

		$("#soform").submit();
	}
</script>
</head>

<body>
	<div class="panel panel-info panel-content">
		<div class="panel-heading">
			<button style="float: right" type="button" onclick="addmsg()" class="btn btn-info">
				<span class="glyphicon glyphicon-plus"></span>
				&nbsp;新增消息
			</button>
			<form id="soform" method="post">
				<table>
					<tr>
						<td class="w80" style="padding-top: 5px">
							<label for="companyname" class="center-block">消息名称：</label>
						</td>
						<td class="w150 ">
							<input type="text" class="form-control" name="so_name" value="${so_name!}" id="so_name" placeholder="消息名称" data-options="">
						</td>
						<td class="w80" style="padding-top: 5px; padding-left: 10px">
							<label for="companyname" class="center-block">消息类别：</label>
						</td>
						<td class="w120 ">
							<select class="form-control" name="so_type">
								<option value="">全部</option>
								[#list dictionarys as dictionary]
								<option value="${dictionary.code}" [#if so_type??][#if dictionary.code==so_type]selected[/#if][/#if]>${dictionary.name}</option>
								[/#list]
							</select>
						</td>
						<td class="w80" style="padding-top: 5px; padding-left: 10px">
							<label for="companyname" class="center-block">用户类型：</label>
						</td>
						<td class="w120 ">
							<select class="form-control" name="so_role">
								<option value="">全部</option>
								<option value="0" [#if so_role??][#if '0'==so_role]selected[/#if][/#if]>采供双方</option>
								<option value="1" [#if so_role??][#if '1'==so_role]selected[/#if][/#if]>采购商</option>
								<option value="2" [#if so_role??][#if '2'==so_role]selected[/#if][/#if]>供应商</option>
							</select>
						</td>
						<td style="padding-left: 10px">
							<div class="input-group">
								<span class="input-group-btn">
									<button class="btn btn-default" type="button" onclick="sosuo()">搜索</button>
								</span>
							</div>
						</td>
					</tr>
				</table>
			</form>
		</div>
		<table class="table table-hover table-bordered table-striped table-condensed">
			<thead>
				<tr>
					<th width="5">序号</th>
					<th width="10%">消息名称</th>
					<th width="15%">消息描述</th>
					<th width="10%">消息类型</th>
					<th width="10%">用户类型</th>
					<th width="10%">消息代码</th>
					<th width="15%">可选择接收方式</th>
					<th width="8%">是否默认</th>
					<!--<th width="7%">是否运营审核</th>-->
					<th width="10%">操作</th>
				</tr>
			</thead>
			[#list pagination.list as azt_msg ]
			<tr>
				<td align="center">${azt_msg_index + 1 + pagination.pageSize*(pagination.pageNo-1)}</td>
				<td align="center">${azt_msg.name!}</td>
				<td align="center">${azt_msg.descr!}</td>
				<td align="center">[#list dictionarys as dictionary][#if azt_msg.msgType??][#if (azt_msg.msgType?substring(0))==dictionary.code]${dictionary.name!}[/#if][/#if][/#list]</td>
				<td align="center">[#if azt_msg.roleType??][#if azt_msg.roleType==0]采供双方[#elseif azt_msg.roleType==1]采购商[#elseif azt_msg.roleType==2]供应商[#else]无[/#if][#else]无[/#if]</td>
				<td align="center">${azt_msg.code!}</td>
				<td align="center">[#if azt_msg.ifMobile==1]短信[/#if]
									[#if azt_msg.ifMobile==1&&azt_msg.ifEmail==1]、[/#if]
									[#if azt_msg.ifEmail==1]邮件[/#if]
									[#if (azt_msg.ifEmail==1||azt_msg.ifMobile==1)&&azt_msg.ifMail==1]、[/#if]
									[#if azt_msg.ifMail==1]站内信[/#if]
				</td>
				<td align="center">[#if azt_msg.ifDefault??][#if azt_msg.ifDefault==0]否[#else]是[/#if][/#if]</td>
				<!--<td align="center">[#if azt_msg.ifAudit??][#if azt_msg.ifAudit==0]否[#else]是[/#if][/#if]</td>-->
				<td align="center">
					<button type="button" class="btn btn-danger btn-xs delbtn" onclick="edit('${azt_msg.id}')">编辑</button>
					<!-- <button type="button" class="btn btn-danger btn-xs delbtn" onclick="del('${azt_msg.id}')">删除</button> -->
				</td>
			</tr>
			[/#list]
		</table>

		<div class="panel-footer">[@fenye p = pagination form = 'infoForm' /]</div>
	</div>
</body>
</html>
<script type="text/javascript">
	//打开新增窗口
	function addmsg() {
		top.addTempTab("/msg/v_add.do");
	}

	//打开编辑窗口
	function edit(id) {
		top.addTempTab("/msg/v_edit.do?so_id="+id);
	}
	//删除
	function del(id) {//弹出警告框判断是否删除
		if (confirm('是否确认删除')) {
			$.ajax({
				url : '/msg/ajax_del.do',
				type : 'get',
				dataType : 'json',
				data : {
					id : id
				},
				beforeSend : function() {
					art.dialog.tips("删除中...");
				},
				success : function(data) {
					if (data.success) {
						location.reload();
					} else {
						error_msg(data.msg, function() {
							location.reload();
						});
					}
				}
			});
		}
	}
	
	
	

</script>